<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>

    </style>
</head>

<body>
    <div class="layuimini-container">
        <div class="layuimini-main">

            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <form class="layui-form layuimini-form" action="">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label required">变量名</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="classIficationName" lay-verify="required" lay-reqtext="请输入标题" placeholder="请输入用户名" value="" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">类型</label>
                                <div class="layui-input-inline">
                                    <select name="interest" lay-filter="mold">
                                        <option value="0" selected="">文本</option>
                                        <option value="1">图片</option>
                                        <option value="2">富文本</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label required">变量编号</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="classIficationName" lay-verify="required" lay-reqtext="请输入标题" placeholder="请输入用户名" value="" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label required">排序字段</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="classIficationName" lay-verify="required" lay-reqtext="请输入标题" placeholder="请输入用户名" value="" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item ssy_mold_container layui-hide moldimg">
                            <label class="layui-form-label">栏目图片</label>
                            <div class="layui-input-block">
                                <div class="layui-upload-drag " id="test10">
                                    <i class="layui-icon">&#xe67c</i>
                                    <p>点击上传，或将文件拖拽到此处</p>
                                    <div class="layui-hide" id="uploadDemoView">
                                        <hr>
                                        <img src="" alt="上传成功后渲染" style="max-width: 196px">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item ssy_mold_container modltext">
                            <label class="layui-form-label">栏目图片</label>
                            <div class="layui-input-block">
                                <textarea name="remarks" placeholder="请输入内容" class="layui-textarea"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item ssy_mold_container layui-hide modlrichtext">
                            <label class="layui-form-label">栏目图片</label>
                            <div class="layui-input-block">
                                <div class="layui-upload-drag " id="test10">
                                    <i class="layui-icon">&#xe67c</i>
                                    <p>点击上传，或将文件拖拽到此处</p>
                                    <div class="layui-hide" id="uploadDemoView">
                                        <hr>
                                        <img src="" alt="上传成功后渲染" style="max-width: 196px">
                                    </div>
                                </div>
                            </div>
                        </div>



                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">备注</label>
                            <div class="layui-input-block">
                                <textarea name="remarks" placeholder="请输入内容" class="layui-textarea"></textarea>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">是否显示</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="effective" lay-skin="primary" title="显示" checked="">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="demo1">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>



            </div>
        </div>
    </div>
    <script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
    <script type="text/javascript">
        layui.use(['form', 'layedit', 'laydate', 'dtree', 'upload', 'element', 'laydate'], function() {
            var $ = layui.jquery,
                form = layui.form,
                layer = layui.layer,
                layedit = layui.layedit,
                laydate = layui.laydate,
                dtree = layui.dtree,
                element = layui.element,
                upload = layui.upload;


            //拖拽上传
            upload.render({
                elem: '#test10',
                url: 'https://httpbin.org/post' //改成您自己的上传接口
                    ,
                done: function(res) {
                    layer.msg('上传成功');
                    layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', res.files.file);
                    console.log(res)
                }
            });
            dtree.renderSelect({
                elem: "#selTree1",
                width: "100%", // 指定树的宽度
                method: 'get',
                url: "../api/asyncTree1.json",
            });

            //监听指定开关
            form.on('switch(switchTest)', function(data) {

                if (this.checked) {
                    $('#hrefdata').show()
                } else {
                    $('#hrefdata').hide()
                }
            });
            //监听下拉开关
            form.on('select(mold)', function(data) {
                console.log(data)
                $('.ssy_mold_container').hide();
                switch (Number(data.value)) {
                    case 0:
                        $('.modltext').removeClass('layui-hide').show();
                        break;
                    case 1:
                        $('.moldimg').removeClass('layui-hide').show();
                        break;
                    case 2:
                        $('.modlrichtext').removeClass('layui-hide').show();
                        break;

                    default:
                        $('.moldimg').removeClass('layui-hide').show();
                        break;
                }

            });

            //监听提交
            form.on('submit(demo1)', function(data) {
                console.log(data)
                layer.alert(JSON.stringify(data.field), {
                    title: '最终的提交信息'
                })
                return false;
            });

        });
    </script>
</body>

</html>